package com.haoze.nurse.controller;

import com.haoze.common.response.Result;
import com.haoze.nurse.model.NurseConsultationGroupEntity;
import com.haoze.nurse.params.ChapApproveParam;
import com.haoze.nurse.params.ChapTempParam;
import com.haoze.nurse.params.ChaperonageParam;
import com.haoze.nurse.service.ChaperonageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping(value = "/nurse/chaperonage")
@Api(value = "陪护")
public class ChaperonageController {

    @Resource
    ChaperonageService chaperonageService;

    @PostMapping("/addChaperonage")
    @ApiOperation(value = "新增陪护")
    public Result addChaperonage(@RequestBody ChaperonageParam param) {
        return chaperonageService.addChaperonage(param);
    }

    @PostMapping("/editChaperonage")
    @ApiOperation(value = "编辑陪护申请")
    public Result editChaperonage(@RequestBody ChaperonageParam param) {
        return chaperonageService.editChaperonage(param);
    }

    @RequestMapping("/uploadFile")
    @ApiOperation(value = "上传文件")
    public Result uploadFile(@RequestBody MultipartFile file, @RequestParam String type) {
        return chaperonageService.uploadFile(file, type);
    }

    @GetMapping("/patientInfo")
    @ApiOperation(value = "获取患者信息")
    public Result patientInfo(@RequestParam String inpatNum,
                              @RequestParam(required = false) String patName) {
        return chaperonageService.patientInfo(inpatNum, patName);
    }

    @GetMapping("/chapList")
    @ApiOperation(value = "获取陪护列表")
    public Result chapList(@RequestParam String idNum) {
        // 传入的是互联网医院的陪护人员在互联网医院注册的idNum
        return chaperonageService.chapList(idNum);
    }

    @GetMapping("/chapNo")
    @ApiOperation(value = "获取患者最新陪护编号")
    public Result chapNo(@RequestParam String inpatNum) {
        return chaperonageService.chapNo(inpatNum);
    }

    @PostMapping("/changePhone")
    @ApiOperation(value = "修改陪护手机号")
    public Result changePhone(@RequestBody ChaperonageParam param) {
        return chaperonageService.changePhone(param);
    }

    @GetMapping("/delChap")
    @ApiOperation(value = "删除陪护申请")
    public Result delChap(@RequestParam String chapId) {
        return chaperonageService.delChap(chapId);
    }

    @GetMapping("/oneChap")
    @ApiOperation(value = "单条陪护申请")
    public Result oneChap(@RequestParam String chapId) {
        return chaperonageService.oneChap(chapId);
    }

}
